/*    

    bobbietalk - a visual programming environment for toy robotics

    Copyright (C) 2013  Roberto Tiella

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

*/
package bobbietalk.gui.blocks.ifblk.close;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
import bobbietalk.gui.blocks.RightBlock;
import java.awt.Rectangle;

/**
 *
 * @author tiella
 */
public class IfCloseRightBlock extends RightBlock {

    private IfCloseBlock ifExitBlock = null;

    public IfCloseRightBlock() {

        setIconOffsetX(-getWidth() / 4);

    }

    public void setExitBlock(IfCloseBlock b) {

        ifExitBlock = b;

    }

    public IfCloseBlock getIfExitBlock() {
        return ifExitBlock;
    }

    protected void setRPosition(int x, int y) {

        Rectangle r = getBounds();

        r.x = x;
        r.y = y;

        setBounds(r);
    }

    public void setRDeltaPosition(int x0, int x, int y0, int y) {

        IfCloseBlock.moveRelative(this, x0, x, y0, y);


    }

    protected void propagateRMotion(int dx, int dy) {
        if (getNextBlock() != null) {
            getNextBlock().propagateMotion(true, dx, dy);

        }
    }
}
